<!doctype html>
<html>
<head>
    <include file="public:headtop"/>
    <link href="//7xk20n.com1.z0.glb.clouddn.com/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css">
    <link href="/static/css/register.css" rel="stylesheet">
</head>

<body>
<div class="logo-box">
    <img src="/static/images/logo02.png" alt="logo" class="img-responsive">
</div>

<div class="container">
    <form action="" method="post">
        <div class="form-group">
            <label class="control-label">*</label>
            <input class="form-control" type="text" name="truename" value="{$userinfo.truename}" required placeholder="姓名"/>
        </div>
        <div class="form-group">
            <label class="control-label">*</label>
            <input class="form-control" type="text" name="idcard" value="{$userinfo.idcard}" required placeholder="身份证号">
        </div>
       <!--  <div class="form-group">
            <label class="control-label">*</label>
            <input class="form-control" type="text" name="idcardimg" required=""
                   value="{$userinfo.idcardimg}"
                   readonly placeholder="点击上传身份证照片" id="idcardimg"/>
            <input name="idcardimg_changed" type="radio" style="display: none"/>
        </div> -->
        <div class="form-group">
            <label class="control-label">*</label>
            <input class="form-control" type="test" name="tel" value="{$userinfo.tel}" required="" placeholder="电话号码" aria-required="true">
        </div>
        <!-- <div class="form-group">
            <label class="control-label">*</label>
            <input class="form-control" type="test" id="bankaccount" name="bankaccount" value="{$userinfo.bankaccount}" required="" placeholder="银行卡账号" aria-required="true">
        </div>
        <div class="form-group">
            <input class="form-control" type="test" name="bankname" id="bankname"
                   value="{$userinfo.bankname}" placeholder="开户行" aria-required="true">
        </div> -->
        <div class="form-group text-center">
            <button class="btn btn-primary" type="submit">保&nbsp;&nbsp;存</button>
            <a class="btn btn-default" href="{:U('User/index')}">返&nbsp;&nbsp;回</a>
        </div>
    </form>
</div>


<script src="http://res.wx.qq.com/open/js/jweixin-1.1.0.js"></script>
<script src="/static/assets/form.js"></script>
<script src="//7xk20n.com1.z0.glb.clouddn.com/plugins/jquery-validation/js/jquery.validate.min.js"></script>
<script src="/static/assets/jquery.validate.zh-cn.js"></script>

<script>
    /*用于绑定移动端点击事件*/
    document.body.addEventListener('touchstart', function () {
    });

    (function() {
        var config = {debug: false};
        config.url = "{$js.url}";
        config.appId = '{$js.appId}';
        config.timestamp = '{$js.timestamp}';
        config.nonceStr = '{$js.nonceStr}';
        config.signature = '{$js.signature}';
        config.jsApiList = ['chooseImage', 'uploadImage'];
        wx.config(config);
    })();

    $(function () {
        var $form = $('form');

        $('#idcardimg').WxUpload(function(serverId) {
            $('#idcardimg').val(serverId).siblings('input:radio').attr('checked', true);
        });


        var $bn = $('#bankname');

        $('#bankaccount').on('change', function() {
            if(! $(this).valid()) return;

            $.getJSON("{:U('Index/bankArea')}&account=" + this.value, function(data) {
                if(data.status == 200) {
                    $bn.val(data.data);
                }
            });
        });

        Form.modify($form, function() {
            $.post('', $form.serialize(), function(data) {
                location.href = "{:U('User/index')}";
            });

            return false;
        });
    });
</script>
</body>
</html>